<?php
/**
 +------------------------------------------------------------------------------
 * 首页，推乐广场
 +------------------------------------------------------------------------------
 * @Version 2.2
 * @Author  WangXian
 * @FileName indexController.php
 * @Creation date 2010-9-10
 * @Modified date 2010-10-11
 +------------------------------------------------------------------------------
 */
class indexController extends controller
{
	public function __construct()
	{
		parent::__construct();
		$this->view = new View();
	}

	public function indexAction()
	{
		//$aa->id=123; //E_STRICT
		H();//FATAL ERROR
		//fopen('/home/a.txt', 'r'); //WARNING
		echo "Hello World!";
	}
	public function infoAction()
	{
		run_info();
	}
	function dbAction()
	{
		$m = QM('test');
		$data = $m->from('test')->findAll();
	}

	function viewAction()
	{
		run_info();
		echo "<br />";
		// 第二种渲染视图的方法
		$this->render('index/myview.tpl.php');
	}
	public function cacheAction()
	{//缓存测试
		F('wx',date('Y-m-d H:i:s'));

		dump(F('wx'));
	}

	//http测试
	function httpAction()
	{
//		if(false == ($auth = Http::getAuthUser() ) )
//		{
//			Http::sendAuthUser('?','xml');
//		}
//		else
//		{
//			dump( $auth );
//		}

		//echo Http::clientIp();
		//Http::sendStatus(404);
		Http::download('','百度.htm', file_get_contents('http://www.baidu.com'));
	}

	function xmlAction()
	{
		header('Content-Type:text/xml; charset=utf-8');
		echo xml_encode($_SERVER);
	}

	function RegexpAction()
	{
		dump(Regexp::check('Mobile','13718174540'));

		//实现原理
		dump(preg_match('/^1[358]\d{9}$/','13718174540'));
	}
	//验证码
	function verifyAction()
	{
		Image::imgVerify();
	}

	// session测试
	function sessionAction()
	{

		dump(C('session'), 'Session设置',1);
		dump($_SESSION);
	}
}